message(STATUS "include LidanAddQT.cmake")

macro(Lidan_InitQt)
    MESSAGE(Status "-----")
    cmake_parse_arguments("ARG" "" "" "COMPONENTS" ${ARGN})
    Lidan_List_Print(TITLE "Qt Components" PREFIX "  - " STRS ${ARG_COMPONENT})

    find_package(Qt5 COMPONENTS REQUIRED ${ARG_COMPONENTS})
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    if(WIN32)
        Lidan_Path_Back(_QtRoot ${Qt5_DIR} 3)
        foreach(_cmpt ${ARG_COMPONENTS})
            set(_dllPathR "${_QtRoot}/bin/Qt5${_cmpt}.dll")
            set(_dllPathD "${_QtRoot}/bin/Qt5${_cmpt}d.dll")
            if(EXISTS ${_dllPathD} AND EXISTS ${_dllPathR})
                install(FILES ${_dllPathD} TYPE BIN CONFIGURATIONS Debug)
                install(FILES ${_dllPathR} TYPE BIN CONFIGURATIONS Release)
            else()
                message(WARNING "file not exist: ${_dllPath}(d).dll")
            endif()
        endforeach()
    endif()
    message(STATUS "----------")

endmacro()